package com.yyy.gui.pannel;

import com.yyy.entity.Record;
import com.yyy.service.ReportService;
import com.yyy.util.ChartUtil;

import javax.swing.*;
import java.awt.*;
import java.util.List;

/**
 * @Author：yyy
 * @Package：com.yyy.gui.pannel
 * @Project：HuTuBiill
 * @name：ReporyPannel
 * @Date：2024/11/9 21:51
 * @Filename：ReporyPannel
 */
public class ReportPannel extends WorkingPanel{

    public static ReportPannel instance=new ReportPannel();

    public JLabel l=new JLabel();

    public ReportPannel(){
        this.setLayout(new BorderLayout());
        List<Record> rs=new ReportService().listThisMonthRecords();
        Image i= ChartUtil.getImage(rs,400,300);
        ImageIcon icon=new ImageIcon(i);
        l.setIcon(icon);
        this.add(l);
    }



    @Override
    public void addListener() {

    }

    @Override
    public void updateData() {
        List<Record> rs=new ReportService().listThisMonthRecords();
        Image i=ChartUtil.getImage(rs,350,250);
        ImageIcon icon=new ImageIcon(i);
        l.setIcon(icon);

    }
}
